<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<form id="form">
  <input type="hidden" value="${brand.id}" name="id">
  <div class="form-group row" >
    <label for="name" class="col-sm-2 col-form-label">名称</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="name" name="name" value="${brand.name}">
    </div>
  </div>
  
  <div class="form-group row">
    <label for="firstChar" class="col-sm-2 col-form-label">首字母</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="firstChar" name="firstChar" value="${brand.firstChar}">
    </div>
  </div>
  
  
  <div class="form-group row">
    <label for="file" class="col-sm-2 col-form-label">图片</label>
    <div class="col-sm-10">
      <img alt="原来的图片" src="/pic/${brand.picPath}"> <input type="file" class="form-control" id="file" name="file">
    </div>
  </div>
  
  <div class="form-group row">
    <label for="file" class="col-sm-2 col-form-label"></label>
    <div class="col-sm-10">
      <button class="btn btn-primary mb-2" type="button" onclick="commitData()"> 提交</button>
    </div>
  </div>
  
  
</form>   
<script type="text/javascript">
	function commitData() {
		var formData = new FormData($("#form")[0]);
		$.ajax({
			url:"../brand/update",
			processData: false,
			type:"post",
			contentType:false,
			data:formData,
			dataType:"json",
			success:function(data){
				alert(data.code)
					$("#workContent").load("../brand/list")
			}
		})
	}

</script> 